package com.firefly.service.command.cms;

import com.firefly.dao.dao.cms.po.LinkPo;
import com.firefly.dao.assembler.cms.LinkAssembler;
import com.firefly.dao.dto.CommonDto;
import com.firefly.dao.dto.cms.LinkDto;
import com.firefly.service.repository.cms.LinkRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: 链接
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/20
 **/
@Service
public class LinkCommand {
    private final LinkAssembler linkAssembler;
    private final LinkRepository linkRepository;
    @Autowired
    public LinkCommand(LinkAssembler linkAssembler,LinkRepository linkRepository){
        this.linkAssembler = linkAssembler;
        this.linkRepository = linkRepository;
    }
    public Boolean create(LinkDto request){
        LinkPo entity = linkAssembler.getPo(request);
        return linkRepository.create(entity);
    }
    public Boolean update(LinkDto request){
        LinkPo entity = linkAssembler.getPo(request);
        return linkRepository.update(entity);
    }
    public Boolean remove(CommonDto request){
        return linkRepository.updateDelFlagByIds(request.detailIds);
    }
}
